<HTML><HEAD><TITLE>sh(+ShellCommand)</TITLE>
</HEAD><BODY>[ <A HREF="index.html">Operating System</A> | <A HREF="../../index.html">Reference Manual</A> | <A HREF="../../fullindex.html">Alphabetic Index</A> ]
<H1>sh(+ShellCommand)</H1>
The string or atom ShellCommand is passed as a command to the operating
system, and the command is executed there (it is a synonym for system/1).


<DL>
<DT><EM>ShellCommand</EM></DT>
<DD>String or atom.
</DD>
</DL>
<H2>Description</H2>
   Used to send a command ShellCommand to the operating system.  The
   command uses the streams input, output and error as the UNIX streams
   stdin, stdout and stderr respectively.  ECLiPSe -specific streams, like
   null or a string stream, can not be used.

<P>

<H3>Modes and Determinism</H3><UL>
<LI>sh(+) is semidet
</UL>
<H3>Fail Conditions</H3>
Fails if the Shell couldn't be executed or if the command returned a non-zero status
<H3>Exceptions</H3>
<DL>
<DT><EM>(4) instantiation fault </EM>
<DD>ShellCommand is not instantiated.
<DT><EM>(5) type error </EM>
<DD>ShellCommand is instantiated, but not to a string or atom.
</DL>
<H2>Examples</H2>
<PRE>
Success:
      [eclipse]: sh('ls -F').
      file1       dir1/
      yes.

      [eclipse]: sh(date).
      Fri Aug  25 12:00:00 MET DST 1989
      yes.

      [eclipse]: sh("cd ..").
      yes.

      [eclipse]: sh('which eclipse').
      /home/user/eclipse
      yes.

Error:
      sh(S).                     (Error 4).
      sh(40).                    (Error 5).



</PRE>
<H2>See Also</H2>
<A HREF="../../kernel/opsys/exec-2.html">exec / 2</A>, <A HREF="../../kernel/opsys/exec-3.html">exec / 3</A>, <A HREF="../../kernel/opsys/exec_group-3.html">exec_group / 3</A>, <A HREF="../../kernel/opsys/setenv-2.html">setenv / 2</A>, <A HREF="../../kernel/opsys/wait-2.html">wait / 2</A>
</BODY></HTML>
